from django.db import models
# from django.contrib.auth.models import User

class Follow_user(models.Model):
    # 关注者
    follower = models.ForeignKey('account_sys.User', related_name='user_following', on_delete=models.CASCADE)
    # 被关注用户
    followee_user = models.ForeignKey('account_sys.User', related_name='user_followers', on_delete=models.CASCADE)

    class Meta:
        unique_together = ('follower', 'followee_user')

    def __str__(self):
        return f"{self.follower} follows {self.followee_user}"

class Follow_enterprise(models.Model):
    # 关注者
    follower = models.ForeignKey('account_sys.User', related_name='enterprise_following', on_delete=models.CASCADE)
    # 被关注企业
    followee_enterprise = models.ForeignKey('enterprise_sys.Enterprise', related_name='enterprise_followers', on_delete=models.CASCADE)

    class Meta:
        unique_together = ('follower', 'followee_enterprise')

    def __str__(self):
        return f"{self.follower} follows {self.followee_enterprise}"
